package com.wxl.common

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.KeyEvent
import com.wxl.common.work.Works

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        Works.newBuilder()
            .add(Work1::class.java)
            .add(Work2::class.java)
            .add(Work3::class.java)
            .add(Work4::class.java)
            .add(Work5::class.java)
            .add(Works.newBuilder()
                .add(Work1::class.java)
                .add(Work2::class.java)
                .add(Work3::class.java)
                .add(Work4::class.java)
                .add(Work5::class.java))
            .build().queue(this)
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
        if(keyCode == KeyEvent.KEYCODE_BACK){
            finish()
        }
        return super.onKeyDown(keyCode, event)
    }

}
